package dto

import "server/internal/app/model"

// 分配管理员角色
type AssignAdminRolesRequest struct {
	AdminID uint   `json:"admin_id" binding:"required,gt=0"`
	RoleIDs []uint `json:"role_ids" binding:"omitempty,dive,gt=0"`
}

// 分配角色权限
type AssignRolePermissionsRequest struct {
	RoleID        uint   `json:"role_id" binding:"required,gt=0"`
	PermissionIDs []uint `json:"permission_ids" binding:"omitempty,dive,gt=0"`
}

// 创建角色
type CreateRoleRequest struct {
	Code   string `json:"code" binding:"required"`
	Name   string `json:"name" binding:"required"`
	Status int8   `json:"status" binding:"omitempty,oneof=1 2"`
}

// 更新角色
type UpdateRoleRequest struct {
	ID     uint   `json:"id" binding:"required,gt=0"`
	Name   string `json:"name" binding:"omitempty"`
	Code   string `json:"code" binding:"omitempty"`
	Status int8   `json:"status" binding:"omitempty,oneof=1 2"`
}

// 删除角色
type DeleteRoleRequest struct {
	ID uint `json:"id" binding:"required,gt=0"`
}

// 创建权限
type CreatePermissionRequest struct {
	Type   model.PermissionType `json:"type" binding:"required,oneof=api menu button"`
	Name   string               `json:"name" binding:"omitempty"`
	Path   string               `json:"path" binding:"required"`
	Status int8                 `json:"status" binding:"omitempty,oneof=1 2"`
}

type UpdatePermissionRequest struct {
	ID     uint                 `json:"id" binding:"required,gt=0"`
	Type   model.PermissionType `json:"type" binding:"omitempty,oneof=api menu button"`
	Path   string               `json:"path" binding:"omitempty"`
	Name   string               `json:"name" binding:"omitempty"`
	Status int8                 `json:"status" binding:"omitempty,oneof=1 2"`
}

type DeletePermissionRequest struct {
	ID uint `json:"id" binding:"required,gt=0"`
}

type AssignRolePermissionRequest struct {
	RoleID        uint   `json:"role_id" binding:"required,gt=0"`
	PermissionIDs []uint `json:"permission_ids" binding:"omitempty,dive,gt=0"`
}

type AssignAdminRoleRequest struct {
	AdminID uint   `json:"admin_id" binding:"required,gt=0"`
	RoleIDs []uint `json:"role_ids" binding:"omitempty,dive,gt=0"`
}
